﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.ApplicationBlocks.Data;
namespace ModuleDuoc
{
    public partial class frmBaoCaoKiemNhap : ModuleDuoc.Base.frmTK_Base
    {
        public frmBaoCaoKiemNhap()
        {
            InitializeComponent();
        }
        public override void btnView_Click(object sender, EventArgs e)
        {
            base.btnView_Click(sender, e);
            string sql = "SELECT * FROM view_THUOC_PHIEUNHAPKHOCT where ngaylap between '" + dtpFrom.Value.ToString("MM/dd/yyyy HH:mm:ss") + "' and '" + dtpTo.Value.ToString("MM/dd/yyyy HH:mm:ss") + "'";
            DataTable dt = SqlHelper.ExecuteDataset(System.Configuration.ConfigurationManager.AppSettings["Main.ConnectionString"],
                 CommandType.Text,
                 sql).Tables[0];
            this.dgvData.DataSource = dt;
        }
        public override void btnExportReport_Click(object sender, EventArgs e)
        {
            base.btnExportReport_Click(sender, e);
            frmShowReport frmHead = new frmShowReport(1);
            frmShowReport.strC = frmShowReport.BC.HEAD_BAOCAOKIEMNHAP;
            frmHead.Show();

            string sql = "SELECT * FROM view_THUOC_PHIEUNHAPKHOCT where ngaylap between '" + dtpFrom.Value.ToString("MM/dd/yyyy HH:mm:ss") + "' and '" + dtpTo.Value.ToString("MM/dd/yyyy HH:mm:ss") + "'";
            DataTable dt = SqlHelper.ExecuteDataset(System.Configuration.ConfigurationManager.AppSettings["Main.ConnectionString"],
                CommandType.Text,
                sql
                ).Tables[0];
            frmShowReport frm = new frmShowReport(1);
            frmShowReport._dt = dt;
            frmShowReport.strC = frmShowReport.BC.BAOCAOKIEMNHAP;
            frm.Show();
        }
    }
}
